#ifndef __MVDEF_MEDIA_H__
#define __MVDEF_MEDIA_H__

#include "mvdef.h"

MVCXX_EXTERN_BEGIN

typedef enum _media_pixel_format
{
    MV_MEDIA_PXLFMT_INVALID     =   0,
    MV_MEDIA_PXLFMT_YUV         =   1, ///< YUV通用格式
    MV_MEDIA_PXLFMT_YUV420SP,
    MV_MEDIA_PXLFMT_YUV422SP,
    MV_MEDIA_PXLFMT_YUV420P,
    MV_MEDIA_PXLFMT_YUV420SP_VU,
    MV_MEDIA_PXLFMT_YUV422P,
    MV_MEDIA_PXLFMT_YUV422P_VU,
    MV_MEDIA_PXLFMT_YUV422_YUYV,
    MV_MEDIA_PXLFMT_YUV422_YVYU,
    MV_MEDIA_PXLFMT_YUV422_UYVY,
    MV_MEDIA_PXLFMT_YUV422_VYUY,
    MV_MEDIA_PXLFMT_YUV400SP,

    MV_MEDIA_PXLFMT_RGB          = 100, ///< RGB通用格式
    MV_MEDIA_PXLFMT_RGB565,
    MV_MEDIA_PXLFMT_BGR565,
    MV_MEDIA_PXLFMT_RGB555,
    MV_MEDIA_PXLFMT_BGR555,
    MV_MEDIA_PXLFMT_RGB444,
    MV_MEDIA_PXLFMT_BGR444,
    MV_MEDIA_PXLFMT_ARGB1555,
    MV_MEDIA_PXLFMT_ABGR1555,
    MV_MEDIA_PXLFMT_RGBA5551,
    MV_MEDIA_PXLFMT_BGRA5551,
    MV_MEDIA_PXLFMT_ARGB4444,
    MV_MEDIA_PXLFMT_ABGR4444,
    MV_MEDIA_PXLFMT_BGRA4444,
    MV_MEDIA_PXLFMT_RGB101010,
    MV_MEDIA_PXLFMT_BGR101010,
    MV_MEDIA_PXLFMT_ARGB8888,
    MV_MEDIA_PXLFMT_ABGR8888,
    MV_MEDIA_PXLFMT_BGRA8888,
    MV_MEDIA_PXLFMT_RGBA8888,
    MV_MEDIA_PXLFMT_BGR888,
    MV_MEDIA_PXLFMT_RGB888,
}mvdef_media_pxlfmt_e;

typedef enum _media_codec
{
    MV_MEDIA_CODEC_INVALID      = 0,
    MV_MEDIA_CODEC_VIDEO_MPEG4  = 1,  ///<MPEG4格式视频
    MV_MEDIA_CODEC_VIDEO_MJPEG,       ///<MJPEG格式视频
    MV_MEDIA_CODEC_VIDEO_H263,        ///<H263格式视频
    MV_MEDIA_CODEC_VIDEO_H264,        ///<H264格式视频
    MV_MEDIA_CODEC_VIDEO_HEVC,        ///<HEVC格式视频
    MV_MEDIA_CODEC_VIDEO_H265   = MV_MEDIA_CODEC_VIDEO_HEVC, ///<H265格式视频
    MV_MEDIA_CODEC_VIDEO_CUSTOM,      ///<定制视频格式
    MV_MEDIA_CODEC_AUDIO_PCM    = 100,///<PCM 格式音频
    MV_MEDIA_CODEC_AUDIO_ADPCM,       ///<ADPCM 格式音频
    MV_MEDIA_CODEC_AUDIO_ADTS_AAC,    ///<AAC-ADTS 格式音频
    MV_MEDIA_CODEC_AUDIO_G711A,       ///<G711-ALAW 格式音频
    MV_MEDIA_CODEC_AUDIO_G711U,       ///<G711U 格式音频
    MV_MEDIA_CODEC_AUDIO_G726,        ///<G726 格式音频
    MV_MEDIA_CODEC_AUDIO_MP3,         ///<MP3 格式音频
    MV_MEDIA_CODEC_AUDIO_AAC,         ///<AAC 格式音频
    MV_MEDIA_CODEC_AUDIO_SPEEX,       ///<SPEEX 格式音频
    MV_MEDIA_CODEC_AUDIO_CUSTOM       ///<定制音频格式
}mvdef_media_codec_e;

typedef enum _media_frame_type
{
    MV_MEDIA_FRAME_INVALID    = 0,    ///<非法/未知类型
    MV_MEDIA_FRAME_VIDEO_I    = 1,    ///<视频I帧
    MV_MEDIA_FRAME_VIDEO_PB   = 2,    ///<视频P/B帧
    MV_MEDIA_FRAME_VIDEO_PB_E = 3,    ///<视频P/B-E帧
    MV_MEDIA_FRAME_AUDIO      = 4,    ///<音频帧
    MV_MEDIA_FRAME_TYPE_MAX,
}mvdef_media_frame_type_e;

typedef enum _media_channel
{
    MV_MEDIA_VIDEO_MAIN_CHN   = 0,    ///<主视频通道
    MV_MEDIA_VIDEO_SUB_CHN,           ///<辅视频通道
    MV_MEDIA_VIDEO_TRD_CHN,           ///<第三视频通道
    MV_MEDIA_VIDEO_MAX_CHN  = 6,      ///<视频最大通道数
    MV_MEDIA_AUDIO_CHN,               ///<音频通道
    MV_MEDIA_CHN_MAX,                 ///<最大通道数
}mvdef_media_channel_e;

typedef struct _mv_media_basic_param
{
    /** video */
    mv_u32_t u32_vcodec;       ///< 视频编解码器类型[mvdef_media_codec_e]
    mv_u32_t u32_width;        ///< 视频宽(pixel)
    mv_u32_t u32_height;       ///< 视频高(pixel)
    /** audio */
    mv_u32_t u32_acodec;       ///< 音频编解码器类型[mvdef_media_codec_e]
    mv_u32_t u32_sample_rate;  ///< 音频采样率(Hz)
    mv_u16_t u16_bits;         ///< 音频位宽
    mv_u16_t u16_chns;         ///< 音频通道数
}mvdef_media_bp_t;

typedef struct _mv_media_data_basic_info {
    mv_u8_t    u8_type;         ///< 媒体数据类型[mvdef_media_frame_type_e] */
    mv_u32_t   u32_data_size;   ///< 媒体数据长度
    mv_time_t  ts_msec;         ///< 系统单调时间（毫秒）
    mv_time_t  ts_abs_msec;     ///< 系统绝对时间（毫秒）
    mv_vptr_t  p_data_vaddr;    ///< 媒体数据地址
}mvdef_media_dbi_t;

MVCXX_EXTERN_END

#endif
